package aso.fighting_groups;

import java.io.File;
import java.util.Locale;

/**
 * Runs experiments.
 */
public class ExperimentProvider {

    /**
     * how many runs per configuration.
     */
    private static int runsPerConfiguration = 30;
    /**
     * simulation time.
     */
    private static double simTime = 1000;

    /**
     * @param args
     *            command line parameters
     */
    public static void main(final String[] args) {

        int teamCount = 2;
        double maxFood = 100;

        int c = 0;

        for (double fsp = 0.000025; fsp < 0.001; fsp *= 2) { // Food spawn
                                                             // probability
            for (double si = 0.06; si <= 0.14; si += 0.02) { // Starvation
                                                             // importance
                for (double fcr = 0.6; fcr <= 1.4; fcr += 0.2) { // Food
                                                                 // consumption
                                                                 // rate
                    for (int i = 0; i < runsPerConfiguration; ++i) {
                        String fileName = String.format(Locale.ENGLISH, "log_%.6f_%.2f_%.1f_%d.txt", fsp, si, fcr, i);
                        FightingGroups fg = new FightingGroups(System.currentTimeMillis(), 100, 100, 100, fsp, teamCount, si, fcr, maxFood, true, "experiments" + File.separator + fileName);
                        fg.start();

                        while (fg.schedule.getTime() < simTime) {
                            fg.schedule.step(fg);
                        }

                        fg.finish();

                        System.out.println(++c);
                    }
                }
            }
        }
    }
}
